﻿/**********************************************************\
*  TinyLib - Node                                          *
*                                                          *
*  Base class for sprites.                                 *
*                                                          *
* (c) Jens Berglind                                        *
*                                                          *
* Last edited by Jens Berglind 25-06-2012                  *
\**********************************************************/ 

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;


namespace AALib.Sprite
{
    public class Node : DrawableGameComponent
    {
       protected SpriteBatch m_spritebatch = null;

        public Vector2 m_position = Vector2.Zero;
        public Vector2 m_scale = new Vector2(1.0f, 1.0f);
        public Vector2 m_origin = Vector2.Zero;

        public List<Node> m_children = new List<Node>();

        public Node(SpriteBatch p_spritebatch, Game p_game)
            : base(p_game)
        {
            this.m_spritebatch = p_spritebatch;
        }

        public void Translate(Vector2 p_translate)
        {
            m_position += p_translate;
            foreach (Node node in m_children)
            {
                node.m_position += p_translate;
            }
        }
    }
}
